#{if proj}
	<script type="text/javascript" charset="utf-8">
		$(function() {
			#{if connected.projects.contains(proj)}loadBox('/tasks/view_task?mine=1&project_id=${proj.id}', 'workspace-${proj.id}');#{/if}
		})
	</script>
#{/if}
<table><tr><td style="height:10px">
<div class="topper nav">
#{if proj}
	<!-- DO NOT REMOVE THIS! If you want to, hide the class.. this element is used to create the top button! -->
	<span class="project_name_in_header">${proj?.name}</span>
	#{if connected.projects.contains(proj)}
	<a href="#" onclick="loadBox('/tasks/view_task?mine=1&project_id=${proj.id}','workspace-${proj.id}', 'reload-tasks-${proj.id}')">Tasks <small>(${tasknumber})</small></a>
	#{/if}
	#{elseif connected.isAdmin && proj}
	<a href="#" onclick="loadBox('/tasks/view_task?project_id=${proj.id}','workspace-${proj.id}', 'reload-tasks-${proj.id}')">Tasks <small>(${tasknumber})</small></a>
	#{/elseif}
	#{if proj && proj.sprints.size()!=0}
	<a href="#" onclick="loadBox('/Projects/Artifacts?projectId=${proj.id}','workspace-${proj.id}','do_not_paginate')">Artifacts</a>
	#{/if}
	<a href="#" onclick="loadBox('@{Users.find_users(proj.id,0,0,0)}','workspace-${proj.id}', 'reload-users')">Users <small>(${proj.users.size()})</small></a>
	<a  href="#"onclick="loadBox('@{Projects.events(proj.id)}','workspace-${proj.id}','do_not_paginate')">Events <small>(${proj.sprints.size()+proj.meetings.size()})</small></a>
	<a  href="#"onclick="$('#chatContainer_${proj.id}').slideToggle(400); #{ifnot connected.openChats.contains(proj.chatroom)} signIn(${proj.chatroom.id}); getMessages(${proj.id},${proj.chatroom.id}); #{/ifnot}">Chatroom <small>(${chatters} Online)</small></a>
	#{set activity: proj.activity() /}
	<a href="#" onclick="loadBox('@{Projects.settings(proj.id)}','workspace-${proj.id}', 'do_not_paginate')">Settings</a> 
	<span class="activity-level activity-level-${activity}" title="Activity level: ${activity}/10"> </span>
	<a href="#" onclick="loadBox('/helptopics/topics?projectId=${proj.id}', 'workspace-${proj.id}')">Help</a>
	<a class="right " href="#" onclick="closeWindows(${proj.id});" title="Close all windows">Close all windows</a>
#{/if}

#{else}
	<span class="project_name_in_header">Admin CP</span>
	<a href="#" onclick="loadBox('/projects/manageProjectRequests', 'workspace--1', 'reload-pending-project-requests')">Project Requests</a>
	<a href="#" onclick="loadBox('/systemsettings', 'workspace--1', 'do_not_paginate')">System Settings</a>
	<a href="#" onclick="overlayOpen('/logs/view?projectId=-1')">Logs</a>
#{/else}

</div>
</td></tr><tr><td style="vertical-align:top ;height:100%">
<div class="workspaceDraggables" id="workspace-${proj?.id ?: -1}">
#{if proj}
	#{if connected}
		<div class="draggable chat"id="chatContainer_${proj.id}"style="position:absolute;right:50px;top:95px;#{ifnot connected.openChats.contains(proj.chatroom)}display:none;#{/ifnot}">
		<div class="ui-widget-header">${proj.name} Chat 
	
			
	
	
	
			<a class="right"href="#" title="signout?" onclick="signOut(${proj.chatroom.id});$('#chatContainer_${proj.id}').hide()" style="text-decoration:none; color:#fff"><span class="ui-icon ui-icon-circle-close"></span></a>
	
				</div>
									<div class="ui-widget-content" style="height:92%;display:table;"id="chatHolder_${proj.name}">
										<div style="display:table-row"id="thread_${proj.id}" class="thread">
											<script type="text/html" id="message_tmpl">
												<div class="<%= message.author == 'notice' ? 'notice allCornersRounded' : message.author == '${connected.name}' ? 'you' : 'them' %>">		
													<strong class="title" style="<%= message.author == 'notice' ? 'display:none !important' : '' %>"><%= message.author%></strong> 
													<%= message.message.replace('\n', '<br/>') %>
												</div>
											</script>
											<div style="height:240px;overflow:auto;" class="cholder" id ="threader_${proj.id}"></div>
										</div>
								<div id="newMessage" style="display:table-row;"class="chatboxinput">	
								<textarea id="message_${proj.name}" name="message_${proj.name}" onclick="$(this).focus()"class="chatboxtextarea"></textarea></div>	
										<script type="text/javascript">
										#{if connected.openChats.contains(proj.chatroom)}
										$(function()
										{
												retrieve(${proj.id},${proj.chatroom.id});
												getMessages(${proj.id},${proj.chatroom.id});
										});
										#{/if}								
											$('#message_${proj.name}').keypress(function(event){
											if (event.keyCode == '13')
											{		var message = $('#message_${proj.name}').val();
											$.post('@{ChatSystem.addMessage()}', {message: message , id:${proj.chatroom.id}}); 
											$('#message_${proj.name}').focus(); 
											$('#message_${proj.name}').val('');
											}
										});
										</script>
									</div>
								</div>
	#{/if}			
#{/if}
</div>
</td></tr><tr><td height="20px"><div class="dock"></div></td></tr></table>
